<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>抽奖管理后台</title>
<style>
body{background:#F4F4FF; font-size:14px; margin:auto}
.divScroll{     OVERFLOW:auto;
        scrollbar-face-color: #FFFFFF;
        scrollbar-shadow-color: #D2E5F4;
        scrollbar-highlight-color: #D2E5F4;
        scrollbar-3dlight-color: #FFFFFF;
        scrollbar-darkshadow-color: #FFFFFF;
        scrollbar-track-color: #FFFFFF; 
      scrollbar-arrow-color: #D2E5F4;
	  }
</style>
<script type="text/javascript">


function changestat(id,stat)
{
	window.location = '<?php echo site_url('adminroot/reward/changestatic/id/');?>/'+id+'/stat/'+stat;
}
</script>


</head>

<body topmargin="0">

<table width="1023" border="0" cellpadding="0" bgcolor="#F4F4FF">
  <tr>
    <td width="235" height="37">&nbsp;</td>
    <td width="782">&nbsp;</td>
  </tr>
  <tr>
    <td height="30">&nbsp;</td>
    <td> 
	<?php
		if($enabled < 2){
	?>
	<input type="button" value="添加奖项"  onclick="window.location='<?php echo base_url('adminroot/reward/addreward');?>'"/>
	<?php
	}
	?>
	</td>
  </tr>
  <tr>
    <td height="485" align="center" valign="top">
    <?php require_once 'left.php';?></td>
    <td valign="top" align="center">
	<?php if($enabled < 2){?>
    <table width="100%" border="0" cellpadding="0">
      <tr>
        <td height="97" valign="top">
        <div align="center" style="width: 90%px; height: 200px; background:#FFFFFF" class="divScroll">
        <table width="100%" border="0" cellpadding="0">
        <?php 
        
        foreach($list as $key => $value1){ 
        	if(empty($value1->enabled)){
        ?>
			<tr onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';">
            	<td>
                <table width="100%">
                	<tr>
                    <td width="68%" height="26" align="left"><font color="#FF0000">活动信息:</font><?=$value1->infos?></td>
                    <td width="32%" rowspan="4">
                        <input type="button" name="button" id="button" value="启动" onclick="changestat(<?=$value1->id?>,1)"/>
                        <input type="button" name="button" id="button" value="编辑" onclick="window.location='<?php echo base_url('adminroot/reward/edit_reward/id/'.$value1->id);?>';"/>
                        <input type="button" name="button" id="button" value="删除" onclick="window.location='<?php echo base_url('adminroot/reward/del_reward/id/'.$value1->id);?>';"/>
                        <input type="checkbox" name="checkbox" id="checkbox" />自动启动
                    </td>
                  </tr>
                  <tr>
                    <td height="25" align="left"><font color="#FF0000">奖励金额:</font><?=$value1->prices?><font color="#FF0000">单位金额:</font><?=$value1->singleprice?><font color="#FF0000">中奖率:</font><?=$value1->probability?><font color="#FF0000">总号数:</font><?=$value1->rnum?></td>
                    </tr>
                                      <tr>
                    <td height="25" align="left"><font color="#FF0000">奖励物品:</font>
					<?php
					
					if( !empty($stock[$value1->id])){
						foreach( $stock[$value1->id] as $k2 => $v2){
							echo '<li><strong>'.$v2['productname'].':</strong>'.$v2['cardnum'].'</li>';	
						}
							
					}
					?>
					</td>
                    </tr>
					 <tr>
                    <td height="25" align="left">&nbsp;</td>
                    </tr>
                    </table>
                </td>
            </tr>
            <?php 
        		}
        	}	
        	?>
        </table>
        </div>
        </td>
      </tr>
      <tr>
        <td height="32" align="left"> 
            <input type="button" name="button2" id="button2" value="已启动活动清单" />        </td>
      </tr>
      <tr>
        <td height="318" valign="top">
        <div align="center" style="width: 90%px; height: 300px; background:#FFFFFF" class="divScroll">
                <table width="100%" border="0" cellpadding="0">
                   <?php 
			        foreach($list as $key => $value){ 
			        	if($value->enabled == 1){
			        ?>
                    <tr onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';">
                        <td height="14">
                        <table width="100%" border="0" cellpadding="0">
                          <tr>
                            <td width="24%" align="left"><?=$value->infos?></td>
                            <td width="13%"><font color="#FF0000">参与人数：</font>2</td>
                            <td width="15%"><font color="#FF0000">选号状态：</font><a href="lottery/lottery_view/<?=$value->id?>">3/<?=$value->rnum?></a></td>
                            <td width="17%"><font color="#FF0000">状态：</font>未开奖</td>
                            <td width="31%">                          
                                <input type="button" value="强制结束" onclick="changestat(<?=$value->id?>,2)"/>
                            </td>
                          </tr>
                        </table></td>
                    </tr>
                    <?php 
			        	}
			        }
                    ?>
        		</table>
        </div>
        </td>
      </tr>
    </table>    
    <?php }else{?>
    	<div align="center" style="width: 90%px; height: 500px; background:#FFFFFF" class="divScroll">
		 <table width="100%" border="0" cellpadding="0">
		  <?php 
			    foreach($list as $key => $value){ 
			        	if($value->enabled == 2){
			?>
          <tr onMouseMove="javascript:this.bgColor='#FCFDEE';" onMouseOut="javascript:this.bgColor='#FFFFFF';">
            <td width="100%">
           <table width="100%" border="0" cellpadding="0">
          <tr>
            <td align="left"><strong><?=$value->infos?></strong> <font color="#FF0000">参与人数：</font>2</td>
            </tr>
          
           <tr>
            <td height="25" align="left"><font color="#FF0000">开始时间:</font> <?=date('Y-m-d',$value->beginDate)?> <font color="#FF0000">结束时间：</font><?=date('Y-m-d',$value->endDate)?></td>
            </tr>
                       <tr>
            <td height="25" align="left"><font color="#FF0000">中奖率：</font><?=$value->rnum?>选<?=count(explode(',',$value->products))?></td>
            </tr>
    
            <?php 
            if(!empty($product[$value->id]))
            {
            	foreach($product[$value->id] as $v){
            ?>
                        <tr>
            <td height="25" align="left">中奖人：<?=$v['txusername']?> 中奖号码：<?=$v['rnum']?> 奖品：<?=$v['productname']?></td>
            </tr>
            <?php 
            	}
            }
            ?>
             <tr>
            <td height="25"></td>
            </tr>

        </table>
            </td>
          </tr>
          <?php
			 }
			    }
          ?>          
                
        </table>
	<div>
	<?php }?>
    </td>
  </tr>
</table>


</body>
</html>
